/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.DealManager;
/*    */ import com.newcrm.exception.DBException;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.util.Map;
/*    */ import javax.servlet.RequestDispatcher;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ 
/*    */ public class ShowDealNote extends AbstractAction
/*    */ {
/* 21 */   private int id = 0;
/*    */ 
/*    */   public ShowDealNote(AbstractHttpServlet servlet) {
/* 24 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public ShowDealNote(AbstractHttpServlet servlet, String id) {
/* 28 */     super(servlet);
/* 29 */     this.id = Util.str2Int(id);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 35 */     User user = super.getLoginUser(request);
/* 36 */     DealManager manager = new DealManager();
/* 37 */     Map deanInfo = null;
/*    */     try {
/* 39 */       deanInfo = manager.getNoteInfo(this.id);
/* 40 */       if (deanInfo == null) {
/* 41 */         request.getRequestDispatcher("/errorpage.jsp").forward(request, 
/* 42 */           response);
/* 43 */         return;
/*    */       }
/* 45 */       String permissionsId = (String)deanInfo.get("PermissionsId");
/* 46 */       int visible = Util.str2Int(deanInfo.get("Visible"));
/*    */ 
/* 48 */       if ((!user.isAdmin) && 
/* 49 */         (!user.userId.equals(permissionsId)) && 
/* 50 */         (visible != 1)) {
/* 51 */         request.getRequestDispatcher("/errorpage.jsp").forward(
/* 52 */           request, response);
/* 53 */         return;
/*    */       }
/*    */     }
/*    */     catch (DBException e) {
/* 57 */       e.printStackTrace();
/*    */ 
/* 60 */       request.setAttribute("dealInfo", deanInfo);
/* 61 */       request.getRequestDispatcher("/deal_note_modify.jsp").forward(request, 
/* 62 */         response);
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.ShowDealNote
 * JD-Core Version:    0.6.1
 */